package com.reborn.mall.api.controller;

import com.reborn.mall.api.model.dto.ProductCategoryDTO;
import com.reborn.mall.api.model.entity.ProductCategory;
import com.reborn.mall.api.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品分类-Controller
 *
 * @author wu.yue
 * @since 2020/1/27
 */
@RestController
@RequestMapping("/products/categories")
public class ProductCategoryController extends BaseController<ProductCategory> {

    @Autowired
    private ProductCategoryService productCategoryService;

    @PostMapping("/create")
    public ProductCategory createProductCategory(@ModelAttribute ProductCategoryDTO productCategoryDTO) {
        return productCategoryService.createProductCategory(productCategoryDTO);
    }
}
